/*
 * InfoPanelCreatorVisitor.cpp
 *
 *  Created on: 10-01-2011
 *      Author: Przemek
 */

#include "world/visitors/InfoPanelCreatorVisitor.hpp"
#include "customUI/BarrierInfoPanel.hpp"
#include "customUI/IndividualInfoPanel.hpp"
#include "customUI/MeatSupplyInfoPanel.hpp"
#include "customUI/VegetableSupplyInfoPanel.hpp"
#include "customUI/WaterSupplyInfoPanel.hpp"

InfoPanelCreatorVisitor::InfoPanelCreatorVisitor(float parentComponentWidth) :
	parentComponentWidth(parentComponentWidth), infoPanel(0)
{
}

void InfoPanelCreatorVisitor::visit(Barrier& barrier)
{
	infoPanel = new BarrierInfoPanel(&barrier);
}

void InfoPanelCreatorVisitor::visit(Individual& individual)
{
	infoPanel = new IndividualInfoPanel(parentComponentWidth, &individual);
}

void InfoPanelCreatorVisitor::visit(MeatSupply& meatSupply)
{
	infoPanel = new MeatSupplyInfoPanel(parentComponentWidth, &meatSupply);
}

void InfoPanelCreatorVisitor::visit(VegetableSupply& vegetableSupply)
{
	infoPanel = new VegetableSupplyInfoPanel(parentComponentWidth, &vegetableSupply);
}

void InfoPanelCreatorVisitor::visit(WaterSupply& waterSupply)
{
	infoPanel = new WaterSupplyInfoPanel(parentComponentWidth, &waterSupply);
}

SingleElementInfoPanel* InfoPanelCreatorVisitor::getPanel()
{
	return infoPanel;
}
